<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('数据查询')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li class="select-time">
                            <label>工作日期： </label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始日期" name="startTime" autocomplete="off"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束日期" name="endTime" autocomplete="off"/>
                        </li>
                        <li>
                            <label>车牌号：</label>
                            <input type="text" name="plateNo" style="width: 100px;"/>
                        </li>
<!--                        <li>-->
<!--                            <label>设备号：</label>-->
<!--                            <input type="text" name="devId" style="width: 100px;"/>-->
<!--                        </li>-->
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>


        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var prefix = ctx + "device/algorithm";

    $(function() {
        var options = {
            url: prefix + "/queryWorkData",
            detailUrl: prefix + "/detail/{id}",
            modalName: "数据查询",
            columns: [
                {
                    field: 'workDate',
                    title: '工作日期'
                },
                {
                    field: 'plateNo',
                    title: '车牌号'
                },
                {
                    field: 'workSequence',
                    title: '工作序号'
                },
                {
                    field: 'startTime',
                    title: '开始时间'
                },
                {
                    field: 'endTime',
                    title: '结束时间',
                    formatter: (value,row) => {
                        if (row.endTime) {
                            return row.endTime
                        }
                        return '<span class="badge badge-info">进行中</span>';
                    }
                },
                {
                    field: 'duration',
                    title: '测量时长'
                },
                {
                    field: 'concreteVolume',
                    title: '混凝土方量'
                },
                {
                    field: 'concreteType',
                    title: '混凝土标号'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="detail(\'' + row.id + '\')"><i class="fa fa-search"></i>详细</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    /*字典列表-详细*/
    function detail(id) {
        let url = prefix + '/sequence-detail?seqId=' + id;
        $.modal.openTab("详情信息", url);
        // window.open(url, "_blank");
    }
</script>
</body>
</html>